package com.woniu.bh.backstage.dto;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @version: V1.0
 * @author: Xbao
 * @className: PageResult
 * @packageName: com.woniu.bh.backstage.dto
 * @description: 分页查询结果
 * @data: 2020-10-17 17:49
 */
@Data
@NoArgsConstructor
public class PageResult<T> {
    /*
    总条数
     */
    private long totalCount;
    /*
    总页数
     */
    private long totalPage;
    /*
    当前页
     */
    private long pageIndex;
    /*
    每页条数
     */
    private long pageSize;
    /*
    当前页内容
     */
    private List<T> content;

    public PageResult(long totalCount, long pageIndex, long pageSize, List<T> content) {
        this.totalCount = totalCount;
        this.totalPage = totalCount%pageSize==0?(totalCount/pageSize):(totalCount/pageSize)+1;
        this.pageIndex = pageIndex;
        this.pageSize = pageSize;
        this.content = content;
    }


}
